<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>

	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport"
		  content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<!-- load css -->
	<link rel="stylesheet" type="text/css" href="media/layui/css/layui.css"
		  media="all">
	<link rel="stylesheet" type="text/css" href="media/css/login.css"
		  media="all">
	<link rel="stylesheet" type="text/css" href="media/css/verify.css">
</head>
<body class="layui-bg-black">
<div class="layui-canvs"></div>
<div class="layui-layout layui-layout-login">
	<form method="post" onclick="return false">
		<h1>
			<strong>QF登录</strong> <em>Zhengzhou Dongdan Slaughtering training Base
		</em>
		</h1>
		<div class="layui-user-icon larry-login">
			<input type="text" placeholder="账号" class="login_txtbx" id="no"
				   name="no" value="EB100" />
		</div>
		<div class="layui-pwd-icon larry-login">
			<input type="password" placeholder="密码" name="password" id="password"
				   value="123456" class="login_txtbx" />
		</div>
		<div class="feri-code">
			<div id="mpanel4"></div>

		</div>
		<div class="layui-submit larry-login">
			<input type="button" id="btn1" disabled="disabled" value="立即登陆"
				   class="submit_btn" />
		</div>
	</form>
	<div class="layui-login-text">
		<p>© 202016-18 郑州QF科技有限公司大牛 版权所有</p>
	</div>
</div>
<script type="text/javascript" src="media/layui/layui.all.js"></script>
<script type="text/javascript" src="media/js/login.js"></script>
<!--互动的粒子动画特效插件  -->
<script type="text/javascript" src="media/js/jparticle.jquery.js"></script>
<script type="text/javascript" src="media/js/verify.min.js"></script>
<script type="text/javascript">
	$(function() {
		//互动的粒子动画特效插件
		$(".layui-canvs").jParticle({
			background: "#ec4040",
			color: "#E6E6E6"
		});
		//滑动验证码
		$('#mpanel4').pointsVerify({
			defaultNum : 6, //默认的文字数量
			checkNum : 1, //校对的文字数量
			vSpace : 5, //间隔
			imgName : [ '1.jpg', '2.jpg' ],
			imgSize : {
				width : '400px',
				height : '200px',
			},
			barSize : {
				width : '400px',
				height : '40px',
			},
			ready : function() {
			},
			success : function() {
				//......后续操作
				$("#btn1").attr("disabled", false);
			},
			error : function() {
			}

		});

	});
	$("#btn1").click(function() {
		$.ajax({
			type:"post",
			url:"/userlogin",
			data:$("form").serialize(),
			dataType:"json",
			success:function(data){
				console.log(data)
				if(data.code==1){

					var  user = data.data;
					if (user.role == 1){
						window.location.href="/index.html"
					}else {
						window.location.href="/indexStu.html"
					}
				}else {
					alert(data.msg);
				}
			}
		})
	})
</script>

</body>
</html>